#pragma once
#pragma pack(1)

enum { CH_POSITION = 0, CH_MESSAGE = 1, CH_FILE = 2, NUMCHANNELS = 3 };
enum { MAXCLIENTS = 128 };
enum { ST_EMPTY, ST_LOCAL, ST_TCPIP };
enum { MAXTRANS = 5000 };
enum { DISC_NONE = 0, DISC_EOP, DISC_CN, DISC_KICK, DISC_TAGT, DISC_IPBAN, DISC_PRIVATE, DISC_MAXCLIENTS, DISC_TIMEOUT, DISC_OVERFLOW, DISC_NUM };
enum { PROTOCOL_VERSION = 2012 };
enum { MAX_NAME_LENGTH = 16 };

enum {
	CMD_NULL						= 0,

	// start up.
	CMD_CONNECT						= 1,
	CMD_SERVER_INFO					= 2,
	CMD_WELCOME						= 3,

	CMD_UPDATE_POS					= 11,
};

struct Command
{
	Command(BYTE type = CMD_NULL) : Type(type) { }
	BYTE Type;
};

struct ConnectInfoCmd : Command
{
	ConnectInfoCmd() : Command(CMD_CONNECT) {}

	wchar_t PlayerName[MAX_NAME_LENGTH];
	DWORD PassHash;
	BYTE PlayerModel;
};

struct ServerInfoCmd : Command
{
	ServerInfoCmd() : Command(CMD_SERVER_INFO) {}

	BYTE NumClients;
	BYTE ProtocalVersion;
	DWORD SessionID;
	BYTE GameMode;
	BYTE MaxClients;
};

struct WelcomeInfoCmd : Command
{
	WelcomeInfoCmd() : Command(CMD_WELCOME) {}
};

struct UpdatePositionCmd : Command
{
	UpdatePositionCmd() : Command(CMD_UPDATE_POS) {}
	SHORT PosX, PosY, PosZ;
	SHORT RotX, RotY;
};

#pragma pack()
